# 
.PHONY: all

CC=g++
CFLAGS=-c -fpic -Wall -g

SOURCES=transitionTarget.cpp transition.cpp state.cpp pugixml.cpp \
	interpreter.cpp statefactory.cpp 
	#main.cpp

OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=pm
LD_LIBRARY_PATH=$HOME/WORK/SCXML/ivo/src

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@


all:  $(EXECUTABLE) scxml2dot $(SOURCES) Makefile

libmylib.a: $(OBJECTS)
	ar rs $@ $(OBJECTS)

libmylib.so.1: $(OBJECTS)
	gcc -shared -Wl,-soname,libmylib.so.1 \
	    -o libmylib.so.1 $(OBJECTS) -lc
	#ln -s libmylib.so.1 libmylib.so


$(EXECUTABLE): main.o $(SOURCES) libmylib.so.1
	$(CC) $(LDFLAGS) -o $@ main.o -L. -llog4cxx -lapr-1 -laprutil-1 -lmylib

scxml2dot: scxml2dot.o libmylib.so
	$(CC) $(LDFLAGS) -o $@ scxml2dot.o -L. -l mylib  -llog4cxx -lapr-1 -laprutil-1

clean:
	rm -rf *o $(EXECUTABLE)
